package org.example.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.utils.R;
import org.example.service.GeneratorService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Zhujingwei
 * @description
 * @DateTime: 2025/6/14 17:48
 */
@RestController
@RequestMapping("/generator")
@Api(tags = "代码生成")
public class GeneratorController {

    @Resource
    private GeneratorService generatorService;

    @GetMapping("/start")
    @ApiOperation("启动生成器")
    @ApiOperationSupport(order = 1)
    public R<Void> start(@RequestParam String tableName) {
        return R.ok(generatorService.generateCode(tableName));
    }
}
